package com.huyanqi.front.rest.resource.impl;

import java.util.List;

import javax.annotation.Resource;

import com.huyanqi.core.RetdObj;
import com.huyanqi.entity.Friends;
import com.huyanqi.front.rest.RespCode;
import com.huyanqi.front.rest.resource.FriendsListResource;
import com.huyanqi.front.rest.resp.FriendsListResp;
import com.huyanqi.front.rest.service.FriendsRestService;

public class FriendsResourceImpl implements FriendsListResource{

	private FriendsRestService restService;
	
	@Resource(name="FriendsRestService")
	public void setRestService(FriendsRestService restService) {
		this.restService = restService;
	}
	public FriendsRestService getRestService() {
		return restService;
	}
	
	@Override
	public FriendsListResp findMyFriends(Long uid,Integer pageNum,Integer pageSize) {
		FriendsListResp flp = new FriendsListResp();
		try{
			RetdObj<List<Friends>> retd = restService.findMyFriends(uid,pageNum,pageSize);
			flp.setData(retd.getRealObj());
			flp.setCode(RespCode.valueOf(retd.getCode()));
		}catch (Exception e) {
			e.printStackTrace();
			flp.setCode(RespCode.EX_APP);
		}
		return flp;
	}
	
}
